import 'package:flutter/material.dart';

class RywLoginPage extends StatefulWidget {
  const RywLoginPage({Key? key}) : super(key: key);

  @override
  State<RywLoginPage> createState() => _RywLoginPageState();
}

class _RywLoginPageState extends State<RywLoginPage> {
  @override
  void initState() {
    // WidgetsBinding.instance.addPostFrameCallback((_) {
    //   /// 显示状态栏和导航栏(使用QuickActions进入demo页)
    //   SystemChrome.setEnabledSystemUIMode(
    //     SystemUiMode.manual,
    //     overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom],
    //   );
    // });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('登录界面')),
      body: Column(
        children: [
          Text('正常字体'),
          Text('自定义字体', style: TextStyle(fontFamily: 'doudou')),
          Divider(height: 1, color: Colors.grey),
          Text('按钮都带有外边距'),
          Row(
            children: [
              TextButton(onPressed: () {}, child: Text('无背景按钮')),
              TextButton.icon(onPressed: () {}, icon: Icon(Icons.add), label: Text('无背景按钮')),
            ],
          ),
          Row(
            children: [
              ElevatedButton(onPressed: () {}, child: Text('有背景按钮')),
              const SizedBox(width: 8),
              ElevatedButton.icon(
                onPressed: () {},
                icon: Icon(Icons.add),
                label: Text('有背景按钮'),
                // 基本都可以自定义，完全满足需求
                style: ButtonStyle(
                  elevation: MaterialStateProperty.all(0),
                  // 只设置overlayColor还是有波纹效果，想完全去掉就按下面的设置
                  overlayColor: MaterialStateProperty.all(Colors.green),
                  // overlayColor: MaterialStateProperty.all(Colors.transparent),
                  // foregroundColor: MaterialStateProperty.resolveWith((states) {
                  //   return states.contains(MaterialState.pressed) ? Colors.black54 : Colors.black38;
                  // }),
                  // backgroundColor: MaterialStateProperty.resolveWith((states) {
                  //   return states.contains(MaterialState.pressed) ? Colors.black12 : Colors.white;
                  // }),
                ),
              ),
            ],
          ),
          OutlinedButton(onPressed: () {}, child: Text('带边框按钮')),
          // 点击效果是圆形，完全可以不用
          IconButton(
            onPressed: () {},
            icon: Icon(Icons.keyboard_arrow_right),
            highlightColor: Colors.transparent,
          ),
        ],
      ),
    );
  }
}
